package com.hebeu.group.controller;


import com.hebeu.group.pojo.Food;
import com.hebeu.group.service.FoodService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;


public class FoodController {

    private FoodService foodService;
    @Autowired
    public FoodController(FoodService foodService){
        this.foodService=foodService;
    }


    /**
     * 查看菜品信息
     * @param food_id
     * @return
     */
    @RequestMapping(value = "/food/detail")
    @ResponseBody
    public Object FoodDetail(@RequestBody int food_id){
        Food food=foodService.selectSingleFood(food_id);
        return food;
    }


    /**
     * 查看菜品列表
     * @return
     */
    @RequestMapping(value = "/food/list")
    @ResponseBody
    public List<Food> Foodlist(){
        List<Food> foodlist=foodService.selectAllFood();
        return foodlist;
    }


}
